home *** CD-ROM | disk | FTP | other *** search
/ University of Minnesota Welcome Kit 2002 / PC Internet Tool.iso / pc / Extras / IkitSrc / setup.rul next >
Encoding:
Text File  |  1999-08-20  |  22.0 KB  |  925 lines

  1. //
  2. //
  3. // false --> n = 0
  4. //
  5. // true  --> n <> 0
  6. //
  7. // Internet Kit
  8. //
  9. // Homepage    "http://www.umn.edu/adcs"
  10. // news server "news.tc.umn.edu"
  11. // SMTP server "smtp-gw.tc.umn.edu"
  12. //
  13. // AddFolderIcon( FOLDER_DRSKTOP ^ "EARL"
  14. //
  15.  
  16. #define xForceError_TCPIPInstalled               0
  17. #define xForceError_DialUpNetworkingInstalled    0
  18.  
  19.  
  20. #define Z_OurPN               "Internet Toolkit"
  21. #define Z_VERSION             "4.1"
  22. #define Z_PRODUCT_KEY         "product.exe"
  23. #define Z_UNINST_KEY          "key"
  24. #define Z_UNINST_DISPLAY_NAME "U of M Internet Toolkit"
  25.  
  26. #define C_IE                  "Internet Explorer"
  27. #define C_NS                  "Netscape"
  28.  
  29. // From WIKDLL.H and WINUSER.H
  30.  
  31. #define IDD_WELCOME       10205
  32. #define MY_SW_SHOWNORMAL      1
  33. #define MB_YESNO              4
  34. #define IDOK                  1
  35. #define IDCANCEL              2
  36. #define IDABORT               3
  37. #define IDRETRY               4
  38. #define IDIGNORE              5
  39. #define IDYES                 6
  40. #define IDNO                  7
  41.  
  42. #define INOUT
  43.  
  44. // Windows Messages
  45.  
  46. #define WM_SYSCOMMAND    0x0112
  47. #define SC_MINIMIZE      0xF020
  48. #define SC_MAXIMIZE      0xF030
  49.  
  50.  
  51. #define procedure function
  52. #define not !
  53. #define and &&
  54. #define NE  !=
  55. #define or  ||
  56. #define var BYREF
  57.  
  58.  
  59.  
  60.  
  61. // DLL Prototypes
  62.  
  63. prototype WIKDLL.WIKIsThereAModem         ( STRING );
  64. prototype WIKDLL.SetupConnection          ( STRING, STRING, STRING );
  65.  
  66.  
  67. // Function Prototypes
  68.  
  69. prototype InitVars();
  70. prototype Setup_RunOnce ();
  71. prototype OurMoveFileData();
  72. prototype OurProcessBeforeDataMove();
  73. prototype OurProcessAfterDataMove();
  74. prototype OurSetupRegistry();
  75. prototype OurSetupFolders();
  76. prototype OurSetupInstall();
  77. prototype OurSetupScreen();
  78. prototype OurCheckRequirements();
  79. prototype OurDialogShowSdWelcome();
  80. prototype OurDialogShowSdLicense();
  81. prototype OurDialogShowSdSelectFolder();
  82.  
  83.  
  84. prototype IsSys          ( NUMBER );
  85. prototype NWarn          ( STRING, NUMBER );
  86. prototype LaunchHelp     ( STRING );
  87. prototype Abort_Missing  ( STRING, STRING );
  88. prototype CSetVisible_9x ( STRING );
  89. prototype CSetVisible_NT ( STRING );
  90. prototype KeyExists      ( STRING );
  91. prototype Warn           ( STRING );
  92. prototype AbortM         ( STRING );
  93. prototype SelItemT       ( STRING );
  94. prototype SelItemF       ( STRING );
  95. prototype SetAskTitle    ( STRING );
  96. prototype CSelected      ( STRING );
  97.  
  98. prototype OurHandleMoveDataError( NUMBER );
  99.  
  100. prototype Is95                                ();
  101. prototype Is98                                ();
  102. prototype IsNT                                ();
  103.  
  104. prototype MainProg                            ();
  105. prototype SelComponents                       ();
  106. prototype OurShowDialogs                      ();
  107. prototype SetDefaultRoot                      ();
  108. prototype TCPIPInstalled                      ();
  109. prototype InstallComponents                   ();
  110. prototype DlgConnectionType                   ();
  111. prototype OurCleanUpInstall                   ();
  112. prototype CreateModemConnectionIcon           ();
  113. prototype DialUpNetworkingInstalled           ();
  114. prototype Setup_Network_TCPIP_Control_Panel   ();
  115.  
  116.  
  117. prototype CSetVis ( STRING, BOOL   );
  118. prototype VOK_0   ( NUMBER, STRING );
  119. prototype VOK_1   ( NUMBER, STRING );
  120.  
  121. prototype Nxt( var NUMBER, NUMBER );
  122.  
  123. prototype DBSet_STRING ( var BOOL, STRING, STRING, STRING );
  124. prototype DBSet_BINARY ( var BOOL, STRING, STRING, STRING );
  125. prototype MakeBinaryString (var STRING, NUMBER,NUMBER,NUMBER,NUMBER);
  126.  
  127.  
  128. prototype CallInstallerWait   ( STRING, STRING, STRING );
  129. prototype CallInstallerNoWait ( STRING, STRING, STRING );
  130.  
  131.  
  132.  
  133. #include "sdlang.h"
  134. #include "sddialog.h"
  135.  
  136.  
  137. #define UNINST_LOGFILE_NAME   "Uninst.isu"
  138.  
  139. //
  140. // 20 August 1999
  141. //
  142. //
  143. // globals
  144. //
  145. STRING  svSetupType;
  146. BOOL    ModemConn;
  147.  
  148. program
  149.    MainProg();
  150. endprogram
  151.  
  152. #include "sddialog.rul"
  153.  
  154.  
  155.  
  156. //==========================================================================
  157.  
  158. procedure MainProg()
  159.    NUMBER nResult;
  160. begin
  161.    Disable( BACKGROUND );
  162.    InitVars();
  163.    OurCheckRequirements ();
  164.    OurSetupInstall ();
  165.    OurShowDialogs ();
  166.    OurProcessBeforeDataMove ();
  167.  
  168.    nResult = OurMoveFileData ();
  169.    if nResult >= 0 then
  170.       nResult = DeinstallSetReference( TARGETDIR ^ Z_PRODUCT_KEY );
  171.    endif;
  172.  
  173.    if nResult >= 0 then
  174.       nResult = CreateRegistrySet ( "" );
  175.       nResult = CreateShellObjects( "" );
  176.       InstallComponents();
  177.    endif;
  178. end;
  179.  
  180.  
  181. procedure InitVars()
  182. begin
  183.    ModemConn       = TRUE;
  184.    TARGETDIR       = "c:\\internet";
  185.    svSetupType     = "";                  // first as default
  186. end;
  187.  
  188.  
  189.  
  190. function Is95()
  191.    BOOL    R;
  192.    NUMBER  n;
  193.    STRING  s;
  194. begin
  195.    R = IsSys( IS_WINDOWS9X );
  196.    if R then
  197.       GetSystemInfo ( WINMINOR, n, s );
  198.       R = (n < 10);
  199.    endif;
  200. end;
  201.  
  202. function Is98()
  203.    BOOL    R;
  204.    NUMBER  n;
  205.    STRING  s;
  206. begin
  207.    R = IsSys( IS_WINDOWS9X );
  208.    if R then
  209.       GetSystemInfo ( WINMINOR, n, s );
  210.       R = (n >= 10);
  211.    endif;
  212. end;
  213.  
  214. function IsNT()
  215. begin
  216.    return IsSys( IS_WINDOWSNT );
  217. end;
  218.  
  219.  
  220. procedure OurCheckRequirements()
  221.    NUMBER  nvDx, nvDy, nvResult;
  222.    STRING  svResult;
  223.    BOOL    bIsWindowsNT4, bIsWindowsNT351, bIsWindows98, bIsWindows95;
  224.    BOOL    bIs32BitSetup;
  225. begin
  226.    GetExtents( nvDx, nvDy );
  227.    if nvDy < 480 then
  228.       AbortM( "Installation  requires VGA or better resolution." );
  229.    endif;
  230.  
  231.  
  232.    bIsWindowsNT4    = FALSE;
  233.    bIsWindowsNT351  = FALSE;
  234.    bIsWindows95     = Is95();
  235.    bIsWindows98     = Is98();
  236.  
  237.    GetSystemInfo( ISTYPE, nvResult, svResult );
  238.    bIs32BitSetup = (nvResult = 32);
  239.    if bIs32BitSetup then
  240.       if IsNT() then
  241.          if GetSystemInfo( WINMAJOR, nvResult, svResult ) = 0 then
  242.             if nvResult >= 4 then
  243.                bIsWindowsNT4 = TRUE;
  244.             else
  245.                AbortM( "Windows NT 3.5 not supported." );
  246.                bIsWindowsNT351 = TRUE;
  247.             endif;
  248.          endif;
  249.       endif;
  250.    else
  251.       AbortM( "Installation requires Windows 95 or greater." );
  252.    endif;
  253. end;
  254.  
  255.  
  256. procedure OurSetupInstall()
  257. begin
  258.     Enable( CORECOMPONENTHANDLING );
  259.     SdProductName( Z_OurPN );
  260.     Enable( DIALOGCACHE );
  261.     Enable( FULLWINDOWMODE );
  262.     Enable( INDVFILESTATUS );
  263.     SetTitle( " University of Minnesota " +
  264.               Z_OurPN + " " + Z_VERSION, 24, WHITE );
  265.     SetTitle( "", 0, BACKGROUNDCAPTION );
  266.     Enable( BACKGROUND );
  267.     Delay( 1 );
  268. end;
  269.  
  270.  
  271. procedure Nxt( n, r )
  272. begin
  273.    if r = BACK then
  274.       n = n - 1;
  275.    else
  276.       n = n + 1;
  277.    endif;
  278. end;
  279.  
  280. procedure OurShowDialogs()
  281.    NUMBER  n, r;
  282.    STRING  t;
  283. begin
  284.    n = 1;
  285.    repeat
  286.       if n <= 1 then
  287.          t =
  288.             "Welcome to the " + Z_OurPN + " Setup program. "  +
  289.             "This program will install the " +
  290.             Z_OurPN + " on your computer.";
  291.          Nxt( n, SdWelcome( "Step 1 of 5", t ) );
  292.  
  293.       elseif n = 2 then
  294.          t =
  295.             "Please read this License Agreement.";
  296.          Nxt( n, SdLicense( "Step 2 of 5", t, "Do you accept these terms?", SUPPORTDIR ^ "Ilicense.txt") );
  297.  
  298.       elseif n = 3 then
  299.          SetAskTitle( "Step 3 of 5" );
  300.          Nxt( n, DlgConnectionType () );
  301.  
  302.       elseif n = 4 then
  303.          Nxt( n, SdSetupTypeEx( "Step 4 of 5", "", "", svSetupType, 0 ) );
  304.  
  305.       elseif n = 5 then
  306.          SelComponents();
  307.          SelItemT( "Acroread" );
  308.          SelItemT( "Winzip"   );
  309.          if     svSetupType = "Explorer" then
  310.             SelItemT( "Internet Explorer" );
  311.             n = n +1;;
  312.          elseif svSetupType = "Netscape" then
  313.             SelItemT( "Netscape" );
  314.             n = n +1;
  315.          else
  316.             SelItemT( "Internet Explorer" );
  317.             Nxt( n, SdComponentDialog2( "Custom", "", TARGETDIR, "" ) );
  318.          endif;
  319.  
  320.       elseif n = 6 then
  321.          t =
  322.             "Setup will install the "+ Z_OurPN +
  323.             " in the following folder." +
  324.             "\n\n" +
  325.             "To install to this folder, click Next." +
  326.             "\n\n" +
  327.             "To install to a different folder click Browse"+
  328.             " and select another folder." +
  329.             "\n\n" +
  330.             "You can choose not to install the " + Z_OurPN +
  331.             " by clicking Cancel to exit Setup.";
  332.          r = SdAskDestPath( "Step 5 of 5", t, INOUT TARGETDIR, 0 );
  333.          if r = BACK then
  334.             n = n - 1;
  335.             if svSetupType != "Custom" then
  336.                n = n - 1;
  337.             endif;
  338.          else
  339.             n = n + 1;
  340.          endif;
  341.  
  342.       endif;
  343.  
  344.    until n > 6;
  345. end;
  346.  
  347.  
  348. procedure OurProcessBeforeDataMove()
  349.    NUMBER nResult;
  350.    STRING FN, szAppPath;
  351. begin
  352.    InstallationInfo( "University of Minnesota",
  353.      Z_OurPN, Z_VERSION, Z_PRODUCT_KEY );
  354.  
  355.    FN = UNINST_LOGFILE_NAME;
  356.    nResult = DeinstallStart( TARGETDIR, FN, Z_UNINST_KEY, 0 );
  357.    if nResult < 0 then
  358.       Warn( "UnInstaller setup failed to initialize.  " +
  359.             "You may not be able to uninstall this product." );
  360.    endif;
  361.    RegDBSetItem( REGDB_APPPATH,         TARGETDIR                );
  362.    RegDBSetItem( REGDB_APPPATH_DEFAULT, TARGETDIR ^ Z_PRODUCT_KEY );
  363.    RegDBSetItem( REGDB_UNINSTALL_NAME,  Z_UNINST_DISPLAY_NAME     );
  364. end;
  365.  
  366.  
  367.  
  368. function OurMoveFileData()
  369.     NUMBER nResult, nDisk;
  370. begin
  371.     nDisk = 1;
  372.     SetStatusWindow( 0, "" );
  373.     Disable( DIALOGCACHE );
  374.     Enable( STATUS );
  375.     StatusUpdate( ON, 100 );
  376.     nResult = ComponentMoveData( MEDIA, nDisk, 0 );
  377.     OurHandleMoveDataError( nResult );
  378.     Disable( STATUS );
  379.     return nResult;
  380. end;
  381.  
  382.  
  383. function OurHandleMoveDataError( nResult )
  384.    STRING szErrMsg, svComponent , svFileGroup , svFile;
  385. begin
  386.    svFile      = "";
  387.    svComponent = "";
  388.    svFileGroup = "";
  389.    if nResult != 0 then
  390.       ComponentError ( MEDIA , svComponent , svFileGroup , svFile , nResult );
  391.       szErrMsg =
  392.           "An error occurred during the move data process:  %d\n\n" +
  393.           "Component: "  + svComponent + "\n" +
  394.           "File Group: " + svFileGroup + "\n" +
  395.           "File: "       + svFile;
  396.       SprintfBox( SEVERE, "", szErrMsg, nResult );
  397.       abort;
  398.    endif;
  399.    return nResult;
  400. end;
  401.  
  402.  
  403. procedure Warn( Msg )
  404. begin
  405.    MessageBox( Msg, WARNING );
  406. end;
  407.  
  408. procedure NWarn( Msg, N )
  409.    STRING S;
  410. begin
  411.    NumToStr( S, N );
  412.    MessageBox( Msg + " <" + S + ">", WARNING );
  413. end;
  414.  
  415. procedure AbortM( Msg )
  416. begin
  417.    Warn( Msg );
  418.    abort;
  419. end;
  420.  
  421.  
  422. function VOK_0( V, Msg )
  423. begin
  424.    if (V != 0) and (Msg != "") then
  425.       NWarn( Msg, V );
  426.    endif;
  427.    return V = 0;
  428. end;
  429.  
  430.  
  431. function VOK_1 (V, Msg)
  432. begin
  433.    if (V != 1) and (Msg != "") then
  434.       Warn( Msg );
  435.    endif;
  436.    return V = 1;
  437. end;
  438.  
  439. function IsSys( N )
  440.    NUMBER nvResult;
  441.    STRING svResult;
  442. begin
  443.    GetSystemInfo( OS, nvResult, svResult );
  444.    return nvResult = N;
  445. end;
  446.  
  447.  
  448. procedure SetAskTitle( S )
  449. begin
  450.    VOK_0( SetDialogTitle( DLG_ASK_OPTIONS, S ), "SetAskTitle Error" );
  451. end;
  452.  
  453.  
  454. //
  455. // Registry procedures
  456. //
  457.  
  458. function SetDefaultRoot()
  459. begin
  460.    return VOK_0( RegDBSetDefaultRoot( HKEY_LOCAL_MACHINE ),
  461.     "SetDefaultRoot Error." );
  462. end;
  463.  
  464.  
  465.  
  466. procedure DBSet_STRING( bv, S1, S2, S3 )
  467. begin
  468.    if bv then
  469.       bv = VOK_0( RegDBSetKeyValueEx( S1, S2, REGDB_STRING, S3, -1 ),
  470.                  "DBSet_STRING Error " + S2 );
  471.    endif;
  472. end;
  473.  
  474.  
  475.  
  476. procedure DBSet_BINARY( bv, S1, S2, S3 )
  477. begin
  478.    if bv then
  479.       bv = VOK_0( RegDBSetKeyValueEx( S1, S2, REGDB_BINARY, S3, 4 ),
  480.                  "DBSet_BINARY Error " + S2 );
  481.    endif;
  482. end;
  483.  
  484.  
  485. function KeyExists( szKey )
  486.    BOOL IsOK;
  487. begin
  488.    IsOK = SetDefaultRoot();
  489.    if IsOK then
  490.       IsOK = VOK_1( RegDBKeyExist( szKey ), "" );
  491.    endif;
  492.    return( IsOK );
  493. end;
  494.  
  495.  
  496.  
  497. function TCPIPInstalled()
  498. begin
  499. #ifdef ForceError_TCPIPInstalled
  500.    return FALSE;
  501. #else
  502.    if IsNT () then
  503.      return TRUE;
  504.    else
  505.      return KeyExists( "\\Enum\\Network\\MSTCP" );
  506.    endif;
  507. #endif
  508. end;
  509.  
  510.  
  511.  
  512.  
  513. //
  514. // MEDIA procedures
  515. //
  516.  
  517. function CSelected( S )
  518. begin
  519.    return ComponentIsItemSelected( MEDIA, S );
  520. end;
  521.  
  522. procedure SelItemT( S )
  523. begin
  524.    VOK_0( ComponentSelectItem( MEDIA, S, TRUE ),
  525.           "SelItemT error " + S );
  526. end;
  527.  
  528. procedure SelItemF( S )
  529. begin
  530.    VOK_0( ComponentSelectItem( MEDIA, S, FALSE ),
  531.           "SelItemF error " + S );
  532. end;
  533.  
  534. procedure CSetVis ( S, IsVis )
  535. begin
  536.    ComponentSetData ( MEDIA, S, COMPONENT_FIELD_VISIBLE, IsVis, "" );
  537. end;
  538.  
  539.  
  540.  
  541.  
  542. procedure CSetVisible_9x( S )
  543. begin
  544.    CSetVis ( S, IsSys( IS_WINDOWS9X ) );
  545. end;
  546.  
  547. procedure CSetVisible_NT( S )
  548. begin
  549.    CSetVis ( S, IsNT() );
  550. end;
  551.  
  552.  
  553. function DialUpNetworkingInstalled()
  554.    BOOL      IsOK;
  555.    string    szKey, szNumValue;
  556.    number    nvNumber, nvType, nvSize;
  557. begin
  558. #ifdef ForceError_DialUpNetworkingInstalled
  559.    return FALSE;
  560. #else
  561.    szKey = "\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\OptionalComponents\\RNA";
  562.    IsOK = KeyExists( szKey );
  563.    if IsOK then
  564.       IsOK = VOK_0( RegDBGetKeyValueEx( szKey, "Installed", nvType, szNumValue, nvSize ), "" );
  565.       if IsOK then
  566.          StrToNum( nvNumber, szNumValue );
  567.          IsOK = (nvNumber = 1);
  568.       endif;
  569.    endif;
  570.    return IsOK;
  571. #endif
  572. end;
  573.  
  574.  
  575. procedure MakeBinaryString (S, b1,b2,b3,b4)
  576. begin
  577.       SetByte( S, 0, b1 );
  578.       SetByte( S, 1, b2 );
  579.       SetByte( S, 2, b3 );
  580.       SetByte( S, 3, b4 );
  581. end;
  582.  
  583.  
  584. function CreateModemConnectionIcon()
  585.    number  i, ModemReturn;
  586.    string  szDLL, szProgram, svString, ProgPath;
  587.    BOOL    bOK, FoundDLL;
  588.    STRING  szConName;        // was global??
  589.  
  590. begin
  591.    szDLL = SUPPORTDIR ^ "WIKDLL.DLL";
  592.    FoundDLL = VOK_0( UseDLL( szDLL ), "UseDLL error!" );            //***DLL START
  593.    bOK = FoundDLL;
  594.  
  595.    if bOK then
  596.       ModemReturn = WIKIsThereAModem( SUPPORTDIR );                         //***DLL CALL
  597.       bOK = (ModemReturn > 0);
  598.  
  599.       if bOK then
  600.          ProgPath = PROGRAMFILES^ "\\Accessories\\";
  601.          bOK = SetupConnection ( SUPPORTDIR,  ProgPath, szConName );//***DLL CALL
  602.          if not bOK then
  603.             Warn( "SetupConnection Error" );
  604.          endif;
  605.       else
  606.         if (ModemReturn = 0) then
  607.           Abort_Missing( "Modem.hlp", "You must have a modem configured to continue." );
  608.         else
  609.           Abort_Missing( "Dialup.hlp", "You must install or reinstall Windows Dialup Networking." );
  610.         endif;
  611.       endif;
  612.    endif;
  613.  
  614.    if bOK then
  615.       bOK = SetDefaultRoot();
  616.    endif;
  617.  
  618.    VOK_0( RegDBSetDefaultRoot( HKEY_CURRENT_USER), "SetDefaultRoot Error." );
  619.  
  620.    DBSet_STRING( bOK, "\\RemoteAccess", "Default", szConName );
  621.    DBSet_STRING( bOK, "\\RemoteAccess", "InternetProfile", szConName );
  622.  
  623.    MakeBinaryString (svString, 0,0,0,0);
  624.    DBSet_BINARY( bOK, "\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings",
  625.      "ProxyEnable", svString);
  626.    MakeBinaryString (svString, 1,0,0,0);
  627.    DBSet_BINARY( bOK, "\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings",
  628.      "EnableAutoDial", svString);
  629.  
  630.    MakeBinaryString (svString, 128,0,0,0);
  631.    /*
  632.    SetByte( svString, 0, 128 );
  633.    for i = 1 to 3
  634.       SetByte( svString, i, 0 );
  635.    endfor;
  636.    */
  637.    DBSet_BINARY( bOK, "\\RemoteAccess", "wizard", svString );
  638.  
  639.    SetDefaultRoot();
  640.  
  641.  
  642.    if FoundDLL then
  643.       VOK_0( UnUseDLL( szDLL ), "UnUseDLL error!" );                //***DLL DONE
  644.    endif;
  645.    return bOK;
  646. end;
  647.  
  648.  
  649.  
  650.  
  651. procedure Setup_Network_TCPIP_Control_Panel()
  652.    string szKey;
  653.    BOOL   b;
  654. begin
  655.    return;
  656. // don't want to do anything.
  657.  
  658.    szKey = "\\System\\CurrentControlSet\\Services\\VxD\\MSTCP";
  659.    b = KeyExists( szKey );
  660.    if b then
  661.       DBSet_STRING  ( b, szKey, "EnableDNS",  "1" );
  662.       DBSet_STRING  ( b, szKey, "HostName",  "LocalHost" );
  663.       DBSet_STRING ( b, szKey, "NameServer", "134.84.84.84,128.101.101.101" );
  664.       DBSet_STRING ( b, szKey, "SearchList", "tc.umn.edu,umn.edu" );
  665.    else
  666.       Warn( "Error:  Key MSTCP does not exist" );
  667.    endif;
  668. end;
  669.  
  670.  
  671. procedure Setup_RunOnce ()
  672.    string szKey;
  673.    BOOL   b;
  674.    string ProgPath;
  675. begin
  676.   b = TRUE;
  677.   ProgPath = "WinHelp.exe " + TARGETDIR ^ "\\Docs\\ReadMe.hlp";
  678.   VOK_0( RegDBSetDefaultRoot( HKEY_CURRENT_USER), "SetDefaultRoot Error." );
  679.   szKey = "\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce";
  680.   DBSet_STRING ( b, szKey, "InternetKit", ProgPath );
  681.   SetDefaultRoot ();
  682. end;
  683.  
  684.  
  685. procedure SelComponents()
  686. begin
  687.    CSetVisible_9x ( "F-Prot Win9x" );
  688.    CSetVisible_NT ( "F-Prot NT"    );
  689.  
  690.    CSetVis ( "Scripting 9X", FALSE );
  691.    CSetVis ( "Scripting NT", FALSE );
  692.  
  693.    SelItemF( "Internet Explorer" );
  694.    SelItemF( "Netscape"          );
  695.    SelItemF( "Acroread"          );
  696.    SelItemF( "Ftp"               );
  697.    SelItemF( "Winzip"            );
  698.    SelItemF( "Irc"               );
  699.    SelItemF( "Palace"            );
  700.    SelItemF( "Labpop"            );
  701.    SelItemF( "Telnet"            );
  702.    SelItemF( "TN3270"            );
  703.    SelItemF( "Scripting 9X"      );
  704.    SelItemF( "Scripting NT"      );
  705.  
  706.    SelItemF( "F-Prot Win9x"      );
  707.    SelItemF( "F-Prot NT"         );
  708.  
  709.    if IsSys( IS_WINDOWS9X ) then
  710.       SelItemT( "Help Files"        );
  711.    else
  712.       SelItemF( "Help Files NT"     );
  713.    endif;
  714.  
  715.    if ModemConn then
  716.       if IsNT() then
  717.          SelItemT( "Scripting NT" );
  718.       else                              //Win98 or later
  719.          SelItemT( "Scripting 9X" );
  720.       endif;
  721.    endif;
  722. end;
  723.  
  724.  
  725.  
  726. procedure LaunchHelp( FN )
  727.    string P;
  728. begin
  729.    P = FN;
  730.    LongPathToQuote( P, TRUE );
  731.    return LaunchApp( "winhlp32.exe", P );
  732. end;
  733.  
  734.  
  735. procedure Abort_Missing( Filename, Msg )
  736.    NUMBER bOpt1, bOpt2, nResult;
  737. begin
  738.    bOpt1 = TRUE;
  739.  
  740.    bOpt2 = FALSE;
  741.  
  742.    SdFinish
  743.      (" ", "Error!\n\n" +
  744.        "Setup is unable to continue.\n\n" + Msg + "\n\n" +
  745.        "Please see the Help File and then re-run this setup program.",
  746.      "Click Finish to exit Setup.",
  747.      "Yes, I want to view HELP now.", "", bOpt1, bOpt2 );
  748.  
  749. /*
  750. bOpt1 = FALSE;
  751. SdFinish
  752.   (" ", "Error!\n\n" +
  753.     "Setup is unable to continue.\n\n" + Msg + "\n\n" +
  754.     "Please read the instructions file and then re-run this setup program.",
  755.   "Click Finish to exit Setup.", "", "", bOpt1, bOpt2 );
  756. */
  757.  
  758.    if bOpt1 then
  759.       nResult = LaunchHelp( TARGETDIR^ "\\Docs\\" + Filename );
  760.    endif;
  761.    abort;
  762. end;
  763.  
  764.  
  765.  
  766. function DlgConnectionType()
  767.    number nResult;
  768.    BOOL   b2;
  769. begin
  770.    if IsSys( IS_WINDOWS9X ) then
  771.       b2 = not ModemConn;
  772.       nResult = AskOptions(
  773.         EXCLUSIVE,
  774.         "Select the way you want to connect to the Internet.",
  775.         "Modem (PPP)", ModemConn,
  776.         "Direct Connection (Ethernet)", b2 );
  777.    else
  778.       nResult   = NEXT;
  779.       ModemConn = TRUE;
  780.    endif;
  781.    return nResult;
  782. end;
  783.  
  784.  
  785. procedure CallInstallerWait ( sPath, sSetup, ErrMsg )
  786.    string ToLaunch;
  787.    number nWnd;
  788. begin
  789.    nWnd = GetWindowHandle( HWND_INSTALL );
  790.    if nWnd < 0 then
  791.       Warn( "GetWindowHandle error");
  792.    else
  793.       SendMessage( nWnd, WM_SYSCOMMAND, SC_MINIMIZE, 0 );
  794.       Delay( 1 );
  795.       ToLaunch = SRCDIR ^ "\\Installs\\" + sPath + "\\" + sSetup;
  796.       if LaunchAppAndWait( ToLaunch, "", WAIT ) < 0 then
  797.          MessageBox( "Unable to install " + ErrMsg, SEVERE );
  798.       else
  799.          SendMessage( nWnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0 );
  800.       endif;
  801.    endif;
  802. end;
  803.  
  804.  
  805. procedure CallInstallerNoWait ( sPath, sSetup, ErrMsg )
  806.    string ToLaunch;
  807.    number nWnd;
  808.    number WaitStat;
  809. begin
  810.    nWnd = GetWindowHandle( HWND_INSTALL );
  811.    if nWnd < 0 then
  812.       Warn( "GetWindowHandle error");
  813.    else
  814.       ToLaunch = SRCDIR ^ "\\Installs\\" + sPath + "\\" + sSetup;
  815.       if LaunchAppAndWait( ToLaunch, "", WaitStat ) < 0 then
  816.          MessageBox( "Unable to install " + ErrMsg, SEVERE );
  817.       endif;
  818.    endif;
  819. end;
  820.  
  821.  
  822. procedure InstallComponents()
  823. begin
  824.    VarSave ( SRCTARGETDIR );
  825.  
  826.    TARGETDIR = TARGETDIR ^ "\\Docs";
  827.  
  828.    SRCDIR = TARGETDIR;
  829.    RenameFile ("TCP_ppp2.hlp","TCP_ppp.hlp");
  830.    RenameFile ("TCP_lan2.hlp","TCP_lan.hlp");
  831.    RenameFile ("DialUp2.hlp" ,"DialUp.hlp");
  832.    RenameFile ("Modem2.hlp"   ,"Modem.hlp");
  833.  
  834.  
  835.    VarRestore ( SRCTARGETDIR );
  836.  
  837.  
  838.    if not TCPIPInstalled() then
  839.      if ModemConn then
  840.        Abort_Missing( "TCP_ppp.hlp", "Windows TCP networking is not installed" );
  841.      else
  842.        Abort_Missing( "TCP_lan.hlp", "Windows TCP networking is not installed" );
  843.      endif;
  844.    endif;
  845.  
  846.  
  847.  
  848.    if CSelected( "Scripting 9X" ) then
  849.       if DialUpNetworkingInstalled() then
  850.          CreateModemConnectionIcon();
  851.       else
  852.          Abort_Missing ("DialUp.hlp", "Dial-up Networking is not installed");
  853.       endif;
  854.    else
  855.       Setup_Network_TCPIP_Control_Panel();
  856.    endif;
  857.  
  858.  
  859.  
  860.    Setup_RunOnce ();
  861.  
  862.    if CSelected( "Acroread") then
  863.       CallInstallerWait( "Acroread", "ar40eng.exe", "Acrobat Reader" );
  864.    endif;
  865.  
  866.    if CSelected( "Palace") then
  867.       CallInstallerWait( "Palace", "setup.exe", "Palace" );
  868.    endif;
  869.  
  870.    if CSelected( "F-Prot Win9x") then
  871.       CallInstallerWait( "F-Prot\\Win9x", "F95xProt.exe", "Command Anti-Virus Software" );
  872.    endif;
  873.  
  874.    if CSelected( "F-Prot NT") then
  875.       CallInstallerWait( "F-Prot\\WinNT", "FwkxProt.exe", "Command Anti-Virus Software" );
  876.    endif;
  877.  
  878.    OurCleanUpInstall();
  879.  
  880.    if CSelected( C_IE ) then
  881.       if CSelected( C_NS ) then
  882.          CallInstallerWait( "MSIE", "ie5setup.exe", "Internet Explorer" );
  883.       else
  884.          CallInstallerNoWait ( "MSIE", "ie5setup.exe", "Internet Explorer" );
  885.       endif;
  886.    endif;
  887.  
  888.    if CSelected( C_NS ) then
  889.       CallInstallerNoWait( "Netscape", "cc32e46.exe", "Netscape Communicator" );
  890.    endif;
  891. end;
  892.  
  893.  
  894.  
  895. procedure OurCleanUpInstall()
  896.    NUMBER bOpt1, bOpt2;
  897.    string S;
  898. begin
  899.    bOpt1 = FALSE;
  900.    bOpt2 = FALSE;
  901.    S = "  When you click on Finish, ";
  902.    if CSelected( C_IE ) then
  903.       if CSelected( C_NS ) then
  904.          S = S + "Internet Explorer and Netscape will install.";
  905.       else
  906.          S = S + "Internet Explorer will install.";
  907.       endif;
  908.    elseif CSelected( C_NS ) then
  909.       S = S + "Netscape will install.";
  910.    else
  911.       S = "";
  912.    endif;
  913.    DeleteDir( TARGETDIR ^ "temp", ALLCONTENTS );
  914.    SdFinish( "Done",
  915.      "You have successfully completed the setup of the Windows " +
  916.      Z_OurPN + "." + S, "", "", "", bOpt1, bOpt2 );
  917. end;
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.